<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>BMI计算</h1>
		<div >
			身高(m)；<input type="text" id="input1"><br>
			体重(KG)；<input type="text" id="input2"><br>
			BMI：<span id="resultSpan"></span><br>
			指数<span id="></span><br>
			<button onclick="cal()">"resultSpan1计算</button>
		</div>
		<script>
			function cal()
			{
				var input1=document.getElementById("input1")
				var input2=document.getElementById("input2")
				var height =input1.value
				var KG =input2.value
				var BMI =KG/(height*height);
				console.log(BMI)
				var resultSpan=document.getElementById("resultSpan")
				resultSpan.innerHTML=BMI
				if(BMI<18.5){
					var resultSpan=document.getElementById("resultSpan1")
					resultSpan.innerHTML="偏小"
				}
				else if(BMI>25.9){
					var resultSpan=document.getElementById("resultSpan1")
					resultSpan.innerHTML="偏大"
				}
				else{
					var resultSpan=document.getElementById("resultSpan1")
					resultSpan.innerHTML="正常"
				}
			}
		</script>
	</body>
</html>
